<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
</head>

<body>
</body>
<script>
    document.addEventListener('visibilitychange', function () { //浏览器切换事件
            console.log('切换')
    })
</script>

</html>